﻿using ET;
using System;

namespace Core
{
    public interface IEvent
    {
        Type Type { get; }
    }

    public abstract class AEvent<A> : IEvent
    {
        public Type Type => typeof(A);

        protected abstract ETTask Run(A a);

        public async ETTask Handle(A a)
        {
            try
            {
                await Run(a);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
    }
}